package com.lanyine.manifold.mybatis.base.mapper;

import com.lanyine.manifold.mybatis.base.provider.InsertSqlProvider;
import com.lanyine.manifold.mybatis.query.ParamsQuery;
import org.apache.ibatis.annotations.InsertProvider;

import java.io.Serializable;

public interface BaseInsertMapper<T, Pk extends Serializable> {

    /**
     * 保存（持久化）对象
     *
     * @param query DML操作辅助类
     */
    @InsertProvider(type = InsertSqlProvider.class, method = "automatic")
    int insert(ParamsQuery query);


    //	/**
//	 * 批量插入（持久化）对象
//	 *
//	 * @param query
//	 *            DML操作辅助类
//	 */
//	@InsertProvider(type = InsertSqlProvider.class, method = "automatic")
//	int insertBatch(ParamsQuery query);

    /**
     * 增量保存（持久化）对象，如果对象(主键)存在，则更新数据，否则插入数据
     *
     * @param query DML操作辅助类
     */
    @InsertProvider(type = InsertSqlProvider.class, method = "automatic")
    int save(ParamsQuery query);
}
